package com._23DesignPattern._structure._proxy.DynamicProxy.other;

import java.lang.reflect.Proxy;

/**
 * @Author: huangya
 * @Date: 2019/3/10
 * @Description:
 */
public class Test002 {

    public static void main(String[] args) {
        IPurchase purchase = new PurchaseImpl();
        LogHandler logHandler = new LogHandler(purchase);
        IPurchase purchase2 = (IPurchase) Proxy.newProxyInstance(purchase.getClass().getClassLoader(), purchase.getClass().getInterfaces(), logHandler);
        purchase2.buy();
        purchase2.buy2();
    }

}
